/**
 * @Description: 第三十章（编写Vue3插件）
 * @Author: IA ia@kepro.space
 * @Date: 2025-02-20 23:22:35
 */

import type { App, VNode } from "vue"
import iLoading from './index.vue'
import { createVNode, render } from "vue";
export default {
  install(app: App) {
    console.log('component 30th index.ts app: ', app);
    console.log('component 30th index.ts iLoading: ', iLoading);
    const vNode: VNode = createVNode(iLoading)
    console.log('component 30th index.ts iLoading createVNode: ', vNode);
    render(vNode, document.body)
    console.log('component 30th index.ts iLoading vNode.component?.exposed: ', vNode.component?.exposed);
    app.config.globalProperties.$iLoading = {
      show: vNode.component?.exposed?.show,
      hide: vNode.component?.exposed?.hide,
    }
    // app.config.globalProperties.$iLoading.show()
    // debugger

  }
}
